export const useFindMenuByCode = (menuList: any[], targetCode: string): any | null => {
  for (const menu of menuList) {
    if (menu.code === targetCode) return menu;
    if (menu.children?.length > 0) {
      const result = useFindMenuByCode(menu.children, targetCode);
      if (result) return result;
    }
  }
  return null;
}